<template>
  <div class="case-query-page">
    <div class="title" slot="header">
      <span class="text">案件列表</span>
      <list-search :cols="columns" @search="searchParamChange" />
    </div>
    <list-table ref="listTable" @selected="selected" />
    
  </div>
</template>
<script>
import ListTable from "@/views/comps/zhzf/list-table";
import CustBtnCol from "@/views/comps/zhzf/list-table-col-btn";

import utils from "@/assets/utils/zhzf-util";
import dictCache from "@/assets/utils/cache-dict-util";
import caseApi from "@/api/system/case";
import ListSearch from "@/views/comps/zhzf/list-search";
import HeadBtns from "@/views/comps/zhzf/head-btns";

import { mapState, mapMutations } from "vuex";
import tabPageMinxin from "@/assets/minxin/tag-page";
import detailView from "./property";
export default {
  mixins: [tabPageMinxin],
  components: { HeadBtns, ListSearch, ListTable, CustBtnCol },
  data() {
    return {
      columns: [
        { title: "案件编号", key: "caseNum", width: 180, sortable: "true" },
        { title: "立案地点", key: "fillingPlace", sortable: "true" },
        {
          title: "立案时间",
          key: "createTime",
          width: 150,
          sortable: "true",
          formatter: (row, col, val) => {
            return utils.formatDts(val, "YYYY-MM-DD HH:mm:ss");
          }
        },
        { title: "立案机构", key: "organName", width: 200, sortable: "true" },
        { title: "当事人", key: "party", width: 80, sortable: "true" },
        {
          title: "执行类型",
          key: "caseTypeId",
          width: 80,
          sortable: "true",
          formatter: (row, col, val) => {
            let dict = dictCache.getDataInfo("0048", val);
            return (dict && dict.name) || "一般程序";
          }
        },
        {
          title: "执法门类",
          key: "zfml",
          width: 80,
          sortable: "true",
          formatter: (row, col, val) => {
            let dict = dictCache.getDataInfo("0055", val);
            return (dict && dict.name) || "道路运政";
          }
        },
        {
          title: "执法人",
          key: "staffstr",
          width: 120,
          sortable: "true",
          formatter: (row, col, val) => {
            let dict = row;
            if (dict.statffs.length > 0) {
              return dict.statffs[0].username;
            } else {
              return "--";
            }
          }
        },
        { title: "案件类型", key: "caseType", width: 80, sortable: "true" },
        {
          title: "操作",
          key: "op",
          component: {
            name: CustBtnCol,
            props: {
              items: [
                { text: "财物管理", emit: "show-detail" },
              ]
            }
          }
        }
      ],
      
    };
  },
  computed: {},
  mounted() {
    this.$bus.$off("show-detail").$on("show-detail", res => {
      let pageTitle = "案件财物列表";
        let rpath = "case/property/property";
        let rname = "caseProperty";
        this.addTabPage(pageTitle, rpath, rname, detailView, {row: res});
    });
    
    this.initPage();
  },
  methods: {
    ...mapMutations({
      pageInit: "d2admin/page/init"
    }),
    searchParamChange(query) {
      //console.log(query);
    },
    selected(rows) {
      // console.log(rows)
    },
    async initPage() {
      await this.$refs.listTable.initPage({
        method: caseApi.pageList,
        cols: this.columns,
        param: { caseStatus: dictCache.getDataInfo("0053", "结案").name }
      });
    }
  }
};
</script>
<style lang="scss">
</style>
